package com.szpx.service.impl;

import com.szpx.entity.CaipingoumaiEntity;
import com.szpx.mapper.CaipingoumaiMapper;
import com.szpx.service.CaipingoumaiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


@Service
@Transactional //事务处理策略
public class CaipingoumaiServiceImpl implements CaipingoumaiService {

    @Autowired
    private CaipingoumaiMapper caipingoumaiMapper;
    //根据id查询影片的信息
    @Override
    public CaipingoumaiEntity selectCById(Integer id) {
        return caipingoumaiMapper.selectByPrimaryKey(id);
    }

    //查询所有影片的信息
    @Override
    public List<CaipingoumaiEntity> selectAllC() {
        return caipingoumaiMapper.selectAll();
    }

    //添加影片信息
    @Override
    public int addCaipin(CaipingoumaiEntity caipingoumaiEntity) {
        return caipingoumaiMapper.insertSelective(caipingoumaiEntity);
    }

    //删除影片信息
    @Override
    public int delCaipin(Integer id) {
        return caipingoumaiMapper.deleteByPrimaryKey(id);
    }


    //修改用户的信息

    @Override
    public int updateCaipin(CaipingoumaiEntity caipingoumaiEntity) {
        return caipingoumaiMapper.updateByPrimaryKeySelective(caipingoumaiEntity);
    }
    //多条件分页模糊查询
    @Override
    public List<CaipingoumaiEntity> getListByCaipin(CaipingoumaiEntity caipingoumaiEntity) {
        return caipingoumaiMapper.getListByCaipin(caipingoumaiEntity);
    }
}